﻿<%@ Register TagPrefix="mnu" Namespace="Mysoft.Map.Application.Menus" Assembly="Mysoft.Map.Application.Components" %>
<%@ Register TagPrefix="mwc" Namespace="MySoft.WebControls" Assembly="MySoft.WebControls" %>
<%@ Register TagPrefix="cnt" Namespace="Mysoft.Map.Application.Controls" Assembly="Mysoft.Map.Application.Components" %>
<%@ Register TagPrefix="cc1" Namespace="Mysoft.PubProject.Business" Assembly="Mysoft.PubProject.Business" %>
<%@ Page language="vb" Inherits="PubProject.Activity_Index" CodeBehind="Activity_Index.aspx.vb" AutoEventWireup="false" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
  <HEAD>
		<title><%=strMode%>执行计划</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
		<style>DIV.editPage { BORDER-RIGHT: #808080 1px solid; PADDING-RIGHT: 10px; BORDER-TOP: #808080 1px solid; OVERFLOW-Y: auto; PADDING-LEFT: 10px; FONT-SIZE: 10pt; OVERFLOW-X: auto; PADDING-BOTTOM: 10px; BORDER-LEFT: #808080 1px solid; WIDTH: 100%; PADDING-TOP: 10px; BORDER-BOTTOM: #808080 1px solid; FONT-FAMILY: 宋体; HEIGHT: 100%; BACKGROUND-COLOR: #ffffff }
	SPAN.dataslug { BACKGROUND-COLOR: #ffff33 }
	#chkIsPersonal { BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; BACKGROUND-COLOR: transparent; BORDER-BOTTOM-STYLE: none }
	</style>
		<LINK href="/_nav/menu.css" type="text/css" rel="stylesheet">
		<LINK href="/_common/styles/global.css" type="text/css" rel="stylesheet">
		<LINK href="/_grid/map_grid.css" type="text/css" rel="stylesheet">
		<LINK href="/_forms/styles/form.css" type="text/css" rel="stylesheet">
		<LINK href="/_nav/tabs.css" type="text/css" rel="stylesheet">
		<LINK href="/_nav/nav.css" type="text/css" rel="stylesheet">
		<LINK href="/_common/styles/select.css" type="text/css" rel="stylesheet">
		<script language="javascript" src="/_common/scripts/global.js"></script>
		<script language="javascript" src="/_common/scripts/Details.js"></script>
		<script language="javascript" src="/_controls/settings.aspx"></script>
		<script language="javascript" src="/_controls/util/util.js"></script>
		<script language="javascript" src="/_controls/datetime/date.js"></script>
		<script language="javascript" src="/_controls/datetime/time.js"></script>
		<script language="javascript" src="/_controls/number/number.js"></script>
		<script language="javascript" src="/_controls/lookup/map_lookup.js"></script>
		<script language="javascript" src="/_nav/menu.js"></script>
		<script language="javascript" src="/_forms/FormBase.js"></script>
		<script language="javascript" src="/PubProject/Activity/Activity.js"></script>
		<script language="javascript" src="Scripts/emailtemplateeditor.js"></script>
		<LINK href="../htmlbar/htmlbar.css" type="text/css" rel="stylesheet">
		<script language="javascript">
		//在线帮助文件
			var _MyHelpfile ="/Slxt/help/topics/客户跟进/客户关怀/新增执行计划.html";
			//数字统计
			function textCounter() 
			{ 
				var regHTML = /{(.|\s)*?}/ig;
				var sResult = document.all("TemplateEditor").innerText.replace(regHTML,"");
				document.all("Count").innerText = sResult.length;
			} 
			
			//功能：提取编辑区内容，清除“数据列”
			function GenHtml()
			{	
			   TemplateEditorHtml.innerHTML = TemplateEditor.innerHTML;
			
				var o;

				for (i = 0; i < TemplateEditorHtml.all.length; i++)
				{
					o = TemplateEditorHtml.all[i];
					
					if (o.tagName == "SPAN" && o.className == "dataslug")
					{
						if (o.childNodes[0])
						{
							o.swapNode(o.childNodes[0]);
						}
						
						o.removeNode();
						
						i--;
					}
				}

				Form1.html.value = TemplateEditorHtml.innerHTML;
				
			}
			//当发送对象发生改变时
		    function ChangeTab(strtype)
		    {
		      if(strtype==0)
		      {
		         tab0.style.display="";
		         tab1.style.display="none";
		         var mode="2";
		         
		   		 if(document.all.sc1.className=="noactive"||document.all.sc1.style.display=="none")
		         {
		           mode="3";
		         }
		         
		         var sFuncId;
		         switch(__open.value)
                    {
                        case "Zlxt":
                            sFuncId = "01040305";
                        break;
                        case "Slxt":
                            sFuncId = __funcid.value;
                        break;
                        case "Hyxt":
                            sFuncId = "01030303";
                        break;
                        case "XTSZ":
                            sFuncId = "00000112";
                        break;
                    }
                    
                 var rdNum = Math.random();
		         document.all("appIframe").src="/PubProject/Activity/Activity_Index_Grid.aspx?mode=" +escape(mode)+"&open=" +escape(document.all.txtAppName.value)+"&BizObject=" +escape(document.all.txtBizObjectRoot.value)+"&BizObjectPK=" +escape(document.all.txtBizObjectPK.value)+"&ReturnValue="+escape(document.all.txtActExecGUID.value)+"&IsOutIn="+escape(document.all.txtIsOutIn.value)+ "&templatetype=" + escape(document.all("txtActType").value) + "&txtIsCreate=" + escape(document.all("txtIsCreate").value) + "&funcid=" + sFuncId + "&rdnum=" + escape(rdNum);     
		         
		         document.getElementById("tdIframe").style.display="";
		         document.getElementById("tdFilter").style.display="none";
		         document.getElementById("NewButton").style.display="none";
		         document.getElementById("LabSearchType").style.display="none";
		      }
		      else
		      {
		         tab1.style.display="";
		         tab0.style.display="none";
		         document.all("appIframe").src="";
		         //显示过滤条件
		         document.getElementById("tdIframe").style.display="none";
		         document.getElementById("tdFilter").style.display="";
                 document.getElementById("NewButton").style.display="";

                 if(document.getElementById("DivFilter").innerText=="")
                 {
                    document.getElementById("DivFilter").innerText="\n 所有数据";
                 }
		         
		         document.getElementById("LabSearchType").style.display="";
		      }
		    
		    }
		    function GetMode()
		    {
		        var mode="2";
		         if(document.all.sc1.className=="noactive"||document.all.sc1.style.display=="none")
		         {
		           mode="3";
		         }
		         return mode;
		    }
		    
		    //发送模板发生变化时
		    function chgddlTemplete()
		    {
		        //去除TemplateEditor焦点，避免TemplateEditor显示不完全的BUG
			    document.all.txtActExecName.focus();
			    
				var sSelValue=document.all("ddlTemplete").value;
				var arrValue = sSelValue.split("|");
				var stemplateID=arrValue[0];
				var sBizObjectView = arrValue[1];
				
				if(sBizObjectView!=""&&sBizObjectView!=undefined)
				{
					document.all.txtBizObject.value = sBizObjectView;
				}
				
				//模板不为空的情况下需要显示编辑列表
				if (document.all("ddlTemplete").value!="")
				{
					var rdNum = Math.random();
					var sFile = "/PubProject/Activity/Activity_Pub_XMLHTTP.aspx?appname=" + escape(document.all("txtAppName").value) + "&templatetype=" + escape(document.all("txtActType").value) + "&rdnum=" + escape(rdNum) + "&templateID=" + escape(stemplateID) ;
					var ReturnValue = openXMLHTTP(sFile,"getTemplateHTML");
					TemplateEditor.innerHTML=ReturnValue;
					trcrmHtmlBar.style.display =""; 
					document.all.TemplateEditor.focus();
				}
				else
				{
				    TemplateEditor.innerHTML="";
				    trcrmHtmlBar.style.display ="none"; 
				   	document.all.txtBizObject.value="";
				}
				
				//数字统计功能
				textCounter();
				
		     	GenHtml();
		    }
			//发送计划类型
			var sOriginalType;      //记录原始的选中类型，防止点击相同的类型时清空
			function ChgMode(sValue)
			{
			    if (sOriginalType == sValue)
			    {
			        return;
			    }
			    else
			    {
			        sOriginalType = sValue;
			    }
				document.all.Section2.style.display="none";
				document.all.Section3.style.display="none";
				document.all.Section4.style.display="none";
				document.all.Section5.style.display="none";
				document.all.txtTmpAutoSendType.value=sValue;
				
				if(sValue=="一次")
				{
				    document.all.RdoSearchType1.disabled=false;
				    document.all.RdoSearchType2.disabled=false;
				    document.all.Section6.style.display="none";
					return;
				}

				if(sValue=="天")
				{
				    document.all.RdoSearchType1.disabled=false;
				    document.all.RdoSearchType2.disabled=false;
                    document.all.SendMonthType2_2.click();

					document.all.Section2.style.display="";
					document.all.Section6.style.display="";
					return;
				}
				if(sValue=="周")
				{
				    document.all.RdoSearchType1.disabled=false;
				    document.all.RdoSearchType2.disabled=false;
					document.all.Section3.style.display="";
					
					document.all.s3_SendWeek0.checked=false;
					document.all.s3_SendWeek1.checked=false;
					document.all.s3_SendWeek2.checked=false;
					document.all.s3_SendWeek3.checked=false;
					document.all.s3_SendWeek4.checked=false;
					document.all.s3_SendWeek5.checked=false;
					document.all.s3_SendWeek6.checked=false;
					
					document.all("txtRepeatDayOrWeek3_1").value="0";
					document.all.Section6.style.display="";
					return;
				}
				if(sValue=="月份")
				{
				    document.all.RdoSearchType1.disabled=false;
				    document.all.RdoSearchType2.disabled=false;
					document.all.Section4.style.display="";
					document.all.Section6.style.display="";
					SetControlsCheckedByValues("s4_SendMonth",1);
					SetControlsCheckedByValues("SendMonthType4",1);
					changeWeek(2)
					document.all.txtSendMonthToDay.value="";
					return;
				}
				if(sValue=="生日")
				{
				    document.all.RdoSearchType1.disabled=true;
				    document.all.RdoSearchType2.disabled=true;
				    document.all.RdoSearchType2.checked=true;
					document.all.Section5.style.display="";
					
					document.all("txtAdvanceDay").value="0";
					document.all.Section6.style.display="";
					ChangeTab(1);
					return;
				}
			}
			
		    //功能：增加内容模板定义
			function TemplateAdd()
			{	
			    //去除TemplateEditor焦点，避免TemplateEditor显示不完全的BUG
			    document.all.txtActExecName.focus();
			    
				//选择模板类型
				var sTitle, sHeight, sWidth, sFile, sFuncId;
							
				sTitle = "内容模板定义";
				sHeight = "520";
				sWidth = "760";
				sFile = "/PubProject/Activity/emailtemplateeditor/emailtemplateeditor.aspx";
				
				// 后缀参数
				var sParams = ""; 
				var strTemplateId;
				
                //参数：mymode	-	Add
                //					Add - 新增
                //					Edit - 编辑
                //      TemplateType -	发送类型
                //      open	-	应用系统
                //      BizObject	 -	数据源
                //      IsTs	-	是否从客户关怀处进入
				sParams += "mymode=" + escape("Add");      
				sParams += "&TemplateType=" + escape(document.all("txtActType").value); 
				sParams += "&open=" + escape(document.all("txtAppName").value);
			    sParams += "&BizObject=" + escape(document.all("ddlYwObject").value.split(";")[0]);
				sParams += "&IsTs=1";

                switch(__open.value)
                {
                    case "Zlxt":
                        sFuncId = "01040110";
                    break;
                    case "Slxt":
                        sFuncId = "01010110";
                    break;
                    case "Hyxt":
                        sFuncId = "01030203";
                    break;
                }
                sParams += "&funcid=" + sFuncId;

				//返回内容模板GUID和数据来源			
				strTemplateId = OpenModalWin(sTitle,sFile,sParams,sWidth,sHeight);

				if(strTemplateId==null)
				{
					return;
				}
				
				//清除ddlTemplete控件的options
				for (var i=Form1.ddlTemplete.options.length-1;i>0;i--)
				{
					Form1.ddlTemplete.options.remove(i);
				}
				
				var rdNum = Math.random();
				
				//参数：appname	-	Slxt
                //      BizObject -	数据源
                //      templatetype	-	发送类型
                //      rdnum	 -	随机数
				var sFile = "/PubProject/Activity/Activity_Pub_XMLHTTP.aspx?appname=" + escape(document.all("txtAppName").value)+ "&BizObject=" + escape(document.all("txtBizObjectRoot").value) + "&templatetype=" + escape(document.all("txtActType").value) + "&rdnum=" + escape(rdNum);
				
				//
				ReturnValue = openXMLHTTP(sFile,"getTemplateTitle");
				if (ReturnValue!=undefined &&ReturnValue!="")
				{
				    var rowcnt;
				    var j;
				    var RowObj=ReturnValue.split(";");
				    var rowcnt=RowObj.length-1;
				    var oOption;
				    var arrValueText;
				    //重新绑定模板列表
				    for(j=0;j<=rowcnt;j++)
				    {
						arrValueText = RowObj[j].split(",");
				        oOption=document.createElement("OPTION");
				        Form1.ddlTemplete.options.add(oOption);
				        oOption.value=arrValueText[0].toLowerCase(); 	
				        oOption.innerText=arrValueText[1];  
				    }	
				}
			    if(strTemplateId!=undefined&&strTemplateId!=null)
			    {
			       document.all.ddlTemplete.value=strTemplateId.toLowerCase().replace("ep_customer_zl","ep_customer");
			    }
			    chgddlTemplete(); 
			}
			
			//选择是否接收短信回复
			function JShous(boolname)
			{
				if (boolname == true)
				{
					document.all.txtSMSReplyCode.readOnly=false;
					document.all.txtSMSReplyCode.className = "";
				}
				else
				{
					document.all.txtSMSReplyCode.value="";
					document.all.txtSMSReplyCode.readOnly=true;
					document.all.txtSMSReplyCode.className = "ro";
				}
				
			}
			
			//保存数据
			function ActSave(strSaveType)
			{   

				//选择短信还是EMail
				var sActType;
				if(document.all.rbSMS.checked==true)
				{
					sActType="短信";
				}
				else
				{
					sActType="Email";
				}
				
				if (sActType == "短信")
				{
				    if (getIsLicenseSMS() == false) return;             //	执行计划的发送类型等于短信，没有购买短信服务赠值模块则提示并返回
				}
								
				//检查参数设置是否完整
				var sFile = "/PubProject/Activity/Activity_Pub_XMLHTTP.aspx?AppName="+escape(document.all.txtAppName.value)+"&ActType=" + escape(sActType);
				var sRtn=GetDataFromXMLHTTP(sFile,"CheckParamSet","","","");
				if (sRtn.substr(0,2) == "NO")
				{
				    alert(sRtn.substr(3));
				    return;
				}
				else if (sRtn.substr(0,2) != "OK")
				{
				    alert("检查信息发送参数失败，请与管理员联系！");
				    return;
				}
				
				//如果选择了生日，则数据源必须为客户或者会员对象，否则无法保存
				if (document.all.txtTmpAutoSendType.value=="生日")
			    {
			        if(document.all.txtAppName.value.toLowerCase()=="slxt") 
			        {
			            if(document.all.txtBizObjectRoot.value.toLowerCase()=="ep_customer")
			            {
			            }
			             else
			            {
			                alert("售楼系统中发送计划为“生日”，数据源必须为“客户”，请重新选择！");
			                return;
			            }
			        }
			        
			        if(document.all.txtAppName.value.toLowerCase()=="hyxt") 
			        {
			            if(document.all.txtBizObjectRoot.value.toLowerCase()=="vp_bizmember")
			            {
			            }
			             else
			            {
			                alert("会员系统中发送计划为“生日”，数据源必须为“会员对象”，请重新选择！");
			                return;
			            }
			        }
			       
			    }
			   
				
				//检查计划名称是否重复
				if(document.all.__mode&&document.all.__mode.value=="1")
				{
				    var sFile = "/PubProject/Activity/Activity_Pub_XMLHTTP.aspx?AppName="+escape(document.all.txtAppName.value)+"&BUGUID=" + escape(document.all.txtBUGUID.value) + "&ActExecName=" + escape(document.all.txtActExecName.value);
				    var sRtn=GetDataFromXMLHTTP(sFile,"CheckActExecName","","","");
				   
				    if (sRtn != "OK")
				    {
				        alert("计划名称重复，请重新填写计划名称！");
				        return;
				    }
				}
				
				//0、准备信息
				//数据保存采用XML的方式把数据传递到后端保存			
				var sMainDataXml="";
				
				//1、主信息 
				sMainDataXml="<XML>";
				//执行记录GUIDE				
				var sActExecGUID = document.all.txtActExecGUID.value;
				sMainDataXml+="<ActExecGUID datatype='uniqueidentifier'>"+sActExecGUID+"</ActExecGUID>";
				var sBUGUID = document.all.txtBUGUID.value;
				sMainDataXml+="<BUGUID datatype='uniqueidentifier'>"+sBUGUID+"</BUGUID>";
				
				//在编辑状态下不保存执行计划的状态
				if (document.all.txtMode.value=="1")
				{
		             var sState=document.all.txtState.value;
			        if(sState=="") sState="待执行"; 
			        sMainDataXml+="<State datatype='varchar'>"+sState+"</State>";		
				}
		
				sMainDataXml+="<AppName datatype='varchar'>"+document.all.txtAppName.value+"</AppName>";
				//活动主题
				var sActExecName = document.all.txtActExecName.value;
				if(sActExecName=="")
				{
					alert("计划名称不能为空！");
					return;
				}
				sMainDataXml+="<ActExecName datatype='varchar'>"+sActExecName+"</ActExecName>";				
				sMainDataXml+="<ActType datatype='varchar'>"+sActType+"</ActType>";
				//制定人姓名
				var sExecutor = document.all.txtExecutor.value;
				if(sExecutor=="")
				{
					alert("制定人不能为空！"); 
					return;
				}
				sMainDataXml+="<Executor datatype='varchar'>"+sExecutor+"</Executor>";
				//制定人GUID
				var sUserGUID = document.all.txtUserGUID.value;
				sMainDataXml+="<UserGUID datatype='uniqueidentifier'>"+sUserGUID+"</UserGUID>";
				//制定日期
				var sExecDate = document.all.txtExecDate.value;
				if(sExecDate=="")
				{
					alert("制定日期不能为空！"); 
					return;
				}
				sMainDataXml+="<ExecDate datatype='datetime'>"+sExecDate+"</ExecDate>";
				//优先级
				var sPriority = document.all.ddlPriority.value;
				sMainDataXml+="<Priority datatype='varchar'>"+sPriority+"</Priority>";
				
				//数据源 
				var sBizObject = document.all.txtBizObjectRoot.value; 
				sMainDataXml+="<BizObject datatype='varchar'>"+sBizObject+"</BizObject>";
				
				var sMAGUID = document.all.txtMAGUID.value; 
				sMainDataXml+="<MAGUID datatype='uniqueidentifier'>"+sMAGUID+"</MAGUID>";
				
				var sBizObjectView=document.all.txtBizObject.value;
				sMainDataXml+="<BizObjectView datatype='varchar'>"+sBizObjectView+"</BizObjectView>";
				
				var sBeginDate=document.all.txtBeginDate.value;
				sMainDataXml+="<BeginDate datatype='datetime'>"+sBeginDate+"</BeginDate>";
				
				if(sBeginDate=="")
				{
					alert("开始日期不能为空！"); 
					return;
				}

				var sEndDate=document.all.txtEndDate.value;

				sMainDataXml+="<EndDate datatype='datetime'>"+sEndDate+"</EndDate>";
				//短信或EMail内容

				var sTemplateContent =document.all("html").value;
				if(sTemplateContent=="")
				{
					alert("内容描述不能为空！");
					return;
				}
				sTemplateContent="<![CDATA["+sTemplateContent+"]]>";
				
				if (sTemplateContent.length> 1512)             
				{
				    alert("内容及其格式合计超过1500个字，请重修调整内容大小或者格式大小！");
				    return;
				}
				
				sMainDataXml+="<TemplateContent datatype='varchar'>"+sTemplateContent+"</TemplateContent>";
				sMainDataXml+="<TemplateContentXML datatype='varchar'/>";
				
				//查询类型
				var sSearchType = "查询条件";
				if(document.all.RdoSearchType1.checked)
				{
				   sSearchType = "查询结果";
				}
				sMainDataXml+="<SearchType datatype='varchar'>"+sSearchType+"</SearchType>";
				

				var sIsImport=document.all.txtIsImport.value;
				sMainDataXml+="<IsImport datatype='tinyint'>"+sIsImport+"</IsImport>";
				var sAutoSendType=document.all.txtTmpAutoSendType.value;
				if(sAutoSendType=="") sAutoSendType="一次";
				sMainDataXml+="<AutoSendType datatype='varchar'>"+sAutoSendType+"</AutoSendType>";
				
				var sCstFilterStru=document.getElementById("txtFilterStru").value;
				var sCstFilter=document.getElementById("divFilter").innerText;
				sMainDataXml+="<CstFilterStru datatype='varchar'>"+sCstFilterStru+"</CstFilterStru>";
				sMainDataXml+="<CstFilter datatype='varchar'>"+sCstFilter+"</CstFilter>";
				
				//2、发送计划
				var sScheduleXml;
				sScheduleXml="<Schedule>";
				/*
					SendMonthType	每月类型选择
					AutoSendTime	发送时间（小时）
					AutoSendMinute	发送时间（分钟）
					SendWeek	星期数（复选）
					RepeatDayOrWeek	重复天数/周数
					SendMonth	月份（复选）
					SendMonthToDay	发送日期（复选）
					SendMonthToBgnWeek	第几周
					ActExecGUID	活动主题GUID
				*/
				sScheduleXml+="<ActExecGUID datatype='uniqueidentifier'>"+sActExecGUID+"</ActExecGUID>";
				var sAutoSendTime=document.all.txtAutoSendTime.value;
				sScheduleXml+="<AutoSendTime datatype='tinyint'>"+sAutoSendTime+"</AutoSendTime>";
				var sAutoSendMinute=document.all.txtAutoSendMinute.value;
				sScheduleXml+="<AutoSendMinute datatype='tinyint'>"+sAutoSendMinute+"</AutoSendMinute>";
				
				if(sAutoSendTime==""||sAutoSendMinute=="")
				{
					alert("开始时间不能为空！");
					return;
				}
				
				switch(sAutoSendType)
				{
					case "一次":
					break;
					
					case "天":
						var sSendMonthType=GetValuesByGroupName("SendMonthType2");
						sScheduleXml+="<SendMonthType datatype='tinyint'>"+sSendMonthType+"</SendMonthType>";
						if(sSendMonthType=="0")
						{
							var sSendWeek=GetValuesByGroupName("s2_SendWeek");
							sScheduleXml+="<SendWeek datatype='varchar'>"+sSendWeek+"</SendWeek>";
						}
						if(sSendMonthType=="2")
						{
							var sRepeatDayOrWeek=document.all.txtRepeatDayOrWeek2_1.value;		
							if (sRepeatDayOrWeek == "")
							{
							    alert("重复执行间隔的天数不能为空！");
							    return;
							}
							sScheduleXml+="<RepeatDayOrWeek datatype='tinyint'>"+sRepeatDayOrWeek+"</RepeatDayOrWeek>";				
						}
					break;
					
					case "周":
						var sRepeatDayOrWeek=document.all.txtRepeatDayOrWeek3_1.value;		
						sScheduleXml+="<RepeatDayOrWeek datatype='tinyint'>"+sRepeatDayOrWeek+"</RepeatDayOrWeek>";		
						var sSendWeek=GetValuesByGroupName("s3_SendWeek");
						if (sSendWeek == "")
						{
						    alert("特定日期不能为空！")
						    return;
						}
						sScheduleXml+="<SendWeek datatype='varchar'>"+sSendWeek+"</SendWeek>";
					break;
					
					case "月份":
						var sSendMonth=GetValuesByGroupName("s4_SendMonth");
						if (sSendMonth == "")
						{
						    alert("月份不能为空！");
						    return;
						}
						sScheduleXml+="<SendMonth datatype='varchar'>"+sSendMonth+"</SendMonth>";
						var sSendMonthType=GetValuesByGroupName("SendMonthType4");
						sScheduleXml+="<SendMonthType datatype='tinyint'>"+sSendMonthType+"</SendMonthType>";
						if(sSendMonthType=="0")
						{
							var sSendMonthToBgnWeek=document.all.ddlSendMonthToBgnWeek.value;
							sScheduleXml+="<SendMonthToBgnWeek datatype='varchar'>"+sSendMonthToBgnWeek+"</SendMonthToBgnWeek>";
							var sSendWeek=GetValuesByGroupName("s4_SendWeek");
							if (sSendWeek == "")
							{
							    alert("星期几不能为空！");
							    return;
							}
							sScheduleXml+="<SendWeek datatype='varchar'>"+sSendWeek+"</SendWeek>";
						}
						
						if(sSendMonthType=="1")
						{
							var sSendMonthToDay=document.all.txtSendMonthToDay.value;
							if (sSendMonthToDay == "")
							{
							    alert("日历日期不能为空！");
							    return;
							}
							sScheduleXml+="<SendMonthToDay datatype='varchar'>"+sSendMonthToDay+"</SendMonthToDay>";
						}
						
					break;
					
					case "生日":
						var sAdvanceDay=document.all.txtAdvanceDay.value;
						if(sAdvanceDay=="") sAdvanceDay="0";
						sScheduleXml+="<AdvanceDay datatype='int'>"+sAdvanceDay+"</AdvanceDay>";
					break;
				}
				
				//////////
				sScheduleXml+="</Schedule>";
				sMainDataXml+=sScheduleXml;


				//如果当前为新增状态则在sMainDataXml后面添加需要添加跟进记录用的客户GUID
				if (document.all.__mode && document.all.__mode.value == "1") {
				    sMainDataXml = sMainDataXml + "<AddCstGUID>" + document.all("txtAddCstGUID").value + "</AddCstGUID>";
				    sMainDataXml = sMainDataXml + "<AddProjGUID>" + document.all("txtProjGUID").value + "</AddProjGUID>";
				    sMainDataXml = sMainDataXml + "<AddTabName>" + document.all("txtAddTabName").value + "</AddTabName>";
				    sMainDataXml = sMainDataXml + "<AddDatasouce>" + document.all("txtDatasouce").value + "</AddDatasouce>";
				}
				
				
				//结尾
				sMainDataXml+="</XML>";
				
				//3、发送对象为查询结果时收件人不能为空
				if(sSearchType == "查询结果")
				{
					var iCnt = document.getElementById("appIframe").contentWindow.appGrid._iTotalRecords;
					if(iCnt==0)
					{
						alert("请设置发送对象！");
						return;
					}
				}
				//为查询条件时查询条件不能为空
//				else
//				{
//					if(sCstFilterStru=="")
//					{
//						alert("请设置发送对象！");
//						return;
//					}
//				}
				
				sFile="/PubProject/Activity/Activity_Pub_XMLHTTP.aspx?mode="+document.all.txtMode.value+"&AppName="+escape(document.all.txtAppName.value)+"&type="+document.all.txtType.value;
				sRtn=GetDataFromXMLHTTP(sFile,"SaveActExecSet","","",sMainDataXml);

				if(sRtn=="OK")
				{
					try {window.opener.document.all("appGrid").Query();}catch(e){};
					
					if (strSaveType==1)
					{
						window.close();	
						return true;
					}	
					document.all.txtIsOutIn.value="";
				    document.all.txtMode.value="2";
				    setAllReadOnly();
				    appNavBar.showTab(1);
             
				    var sUrl="Activity_Index.aspx?mode=2&Guid=" + document.all.txtActExecGUID.value + "&funcid=" + __funcid.value + "&open=" + __open.value + "&rdn=" + Math.random();
			        self.navigate(sUrl);
					
				}
				else
				{
					alert("保存失败！");
				}
			}

			//获取字符串的长度//^^新增
            function GetLen(s)
            {
	            var len=0;
	            for(var i=0;i<s.length;i++)  
	            {
		            chrCode = s.charCodeAt(i);
            		
		            if(parseInt(chrCode) > 255) {
			            len=len+2;
		            } else {
			            len=len+1;
		            }
	            }
	            return len;
            }
			
			//根据GroupName获取单选按钮的值（0/1/2）或者多选按钮的值（0,1,2...）
			function GetValuesByGroupName(sGroupName)
			{
				var sRtn="";
				var arrControls =eval("document.all."+sGroupName);
				var iArr=0;
				var arrLen = arrControls.length;
				for(iArr=0;iArr<arrLen;iArr++)
				{
					if(arrControls[iArr].checked==true)
					{
						sRtn+=","+arrControls[iArr].value;
					}
				}
				//替换第一个逗号,
				sRtn=sRtn.replace(",","");
				return sRtn;
			}
			
			//根据数据值列表设置控件的checked属性
			function SetControlsCheckedByValues(sGroupName,sValues)
			{
				sValues=","+sValues+",";
				var sRtn="";
				var arrControls =eval("document.all."+sGroupName);
				var iArr=0;
				var arrLen = arrControls.length;
				for(iArr=0;iArr<arrLen;iArr++)
				{
					if(sValues.indexOf(","+arrControls[iArr].value)!=-1)
					{
						arrControls[iArr].checked=true;
						if(arrControls[iArr].type=="radio")
						{
							arrControls[iArr].click();
						}
					}
					else
					{
						arrControls[iArr].checked=false;
					}
				}
			}
			
				//根据数据值列表设置控件只读
			function SetControlsDisabled(sGroupNames)
			{
			   var arrControls =eval("document.all."+sGroupNames);
				var iArr=0;
				var arrLen = arrControls.length;
				for(iArr=0;iArr<arrLen;iArr++)
				{					
						arrControls[iArr].disabled=true;						
				}
			}
			
			function setAllReadOnly()
			{   
			    SetControlsDisabled("SearchType");
			    SetControlsDisabled("appForm_AutoSendType");
			    //SetControlsDisabled("s2_SendWeek");
			    SetControlsDisabled("SendMonthType2");
			    SetControlsDisabled("s3_SendWeek");
				
			    SetControlsDisabled("s4_SendMonth");
			    SetControlsDisabled("SendMonthType4");
			    SetControlsDisabled("s4_SendWeek");
			    
			    document.all.txtRepeatDayOrWeek2_1.className ="num ro" ;
			    document.all.txtRepeatDayOrWeek3_1.className ="num ro" ;
			    document.all.ddlSendMonthToBgnWeek.disabled =true ;
			    document.all.txtSendMonthToDay.className ="txt ro";
			    document.all.txtAutoSendTime.className ="num ro";
			    document.all.txtAutoSendMinute.className ="num ro";
			    document.all.txtBeginDate.setReadOnly (true,true);
				document.all.txtActExecName.setReadOnly(true);
				document.all.txtAdvanceDay.setReadOnly(true);

			}
			
			
		//初始化设置
			function window.onload() {
			    try {
			        document.all("txtAddCstGUID").value = window.opener.document.getElementById("txtCstGUIDs").value;
			        document.all("txtProjGUID").value = window.opener.document.getElementById("txtProjGUID").value;
			        document.all("txtAddTabName").value = window.opener.document.getElementById("txtAddTabName").value;
			        document.all("txtDatasouce").value = window.opener.document.getElementById("txtDatasouce").value;
			    }
			    catch (e) {
			    }
		
			if(document.all("__funcid"))
			{
				if(__funcid.value=="00000112")
				{
					_MyHelpfile = "/PubProject/help/Activity_ActivityMNG_xt.htm";
				}
				if(__funcid.value=="01030303")
				{
				     _MyHelpfile = "/Hyxt/help/Hyxt_Activity_ActivityMng.htm";
				}
				if(__funcid.value=="01040110" || __funcid.value=="01040305")
				{
				     _MyHelpfile = "/Zlxt/help/ZSGL/Activity_ActivityMNG.htm";
				}
			}
		    //如果是Email则不需要进行内容的数字统计
		    if(document.all.rbEmail.checked==true )
		    {
		        document.all.CountSMS.style.display="none";
		    }
		    
            if (document.all.RdoSearchType1.checked==true )
            {
			    document.all.NewButton.style.display="none";
			}
			else
			{
			    document.all.NewButton.style.display="";
			}
			//新增内容模板和查询条件下的新增活动人群权限点的控制
		    if(Form1.txtIsCreate.value=="1")
		    {
		     document.all.btnTemplateAdd.disabled=false;
		     document.all.btnTemplateAdd.style.filter="";
		     document.all.NewButton.disabled=false;
		     document.all.NewButton.style.filter="";
		    }
		    var sActExecGUID = document.all("txtActExecGUID").value;
			if(document.all.RdoSearchType1.checked)
			{
			   ChangeTab(0);
			}
			else
			{
			   ChangeTab(1);
			}
			
		
			if(document.all("txtMode").value=="1") 
			{				
			
			    //设置默认选项
				//1、发送类型
				SetControlsCheckedByValues("appForm_AutoSendType","一次");
				//2、计划类型
				SetControlsCheckedByValues("SendMonthType2",1);
				
			    if(document.all("txtIsOutIn").value=="1") 
				{
				   document.all.appForm_AutoSendType3.disabled =true;  
				   document.all.appForm_AutoSendType4.disabled =true;  
				   document.all.appForm_AutoSendType5.disabled =true; 
				   document.all.appForm_AutoSendType6.disabled =true;  
				   document.all.RdoSearchType1.disabled=true; 
				   document.all.RdoSearchType2.disabled=true; 
				}
				

				
				return;
            }
			//如果定义的计划选择了内容模板则显示工具栏
			if(document.all("txtBizObject").value!="")
			{
				trcrmHtmlBar.style.display =""; 
			}
			
		    var sAutoSendType = document.all("txtTbAutoSendType").value;
		    if (sAutoSendType=="") sAutoSendType="一次";
			SetControlsCheckedByValues("appForm_AutoSendType",sAutoSendType);
			
			var sSendMonthType= document.all("txtTbSendMonthType").value;
			
			//起止日期、发送时间所有类别都默认有取数据
			document.all("txtAutoSendTime").value=document.all("txtTbAutoSendTime").value;
			document.all("txtAutoSendMinute").value=document.all("txtTbAutoSendMinute").value;
			document.getElementById("divFilter").innerText = document.getElementById("txtFilter").value;
			
			switch(sAutoSendType)
			{
				case "一次":
					break;
					
					case "天":
						SetControlsCheckedByValues("SendMonthType2",sSendMonthType);
						
						if(sSendMonthType=="0")
						{
							var sSendWeek= document.all("txtTbSendWeek").value;
							SetControlsCheckedByValues("s2_SendWeek",sSendWeek);
						}
						if(sSendMonthType=="2")
						{
							document.all("txtRepeatDayOrWeek2_1").value=document.all("txtTbRepeatDayOrWeek").value;		
						}
					break;
					
					case "周":
						document.all("txtRepeatDayOrWeek3_1").value=document.all("txtTbRepeatDayOrWeek").value;		
						
						var sSendWeek= document.all("txtTbSendWeek").value;
						SetControlsCheckedByValues("s3_SendWeek",sSendWeek);
					break;
					
					case "月份":
						var sSendMonth = document.all("txtTbSendMonth").value;
						SetControlsCheckedByValues("s4_SendMonth",sSendMonth);
						
						var sSendMonthType=document.all("txtTbSendMonthType").value;
						SetControlsCheckedByValues("SendMonthType4",sSendMonthType);
						
						if(sSendMonthType=="0")
						{
							var sSendMonthToBgnWeek=document.all("txtTbSendMonthToBgnWeek").value;
							document.all("ddlSendMonthToBgnWeek").value = sSendMonthToBgnWeek;							
							
							var sSendWeek= document.all("txtTbSendWeek").value;
							SetControlsCheckedByValues("s4_SendWeek",sSendWeek);
						}
						
						if(sSendMonthType=="1")
						{
							document.all("txtSendMonthToDay").value=document.all("txtTbSendMonthToDay").value;
						}
						
					break;
					
					case "生日":
					      document.all.RdoSearchType1.disabled=true;
				          document.all.RdoSearchType2.disabled=true;
				          document.all("txtAdvanceDay").value = document.all("txtTbAdvanceDay").value;
					break;
			}
			
			setAllReadOnly();  			
			//数字统计功能
			textCounter();
			GenHtml();
		}
		
		function changedYwObject()
		{
		    var sActExecGUID = document.all.txtActExecGUID.value;
		    var sddlYwObject = document.all("ddlYwObject").value.split(";")[0];
		    document.all("txtBizObjectRoot").value = sddlYwObject;
		    document.all("txtBizObjectPK").value = document.all("ddlYwObject").value.split(";")[1];
		    var rdNum = Math.random();
		    var sFile = "/PubProject/Activity/Activity_Pub_XMLHTTP.aspx?ywonlyflag=" + escape(sActExecGUID);
		    ReturnValue = openXMLHTTP(sFile,"DeleteActivityReady");
		    if (ReturnValue != "OK")
		    {
		        alert("操作失败，请关闭重试！");
		        return;
		    }
		    
			sFile = "/PubProject/Activity/Activity_Pub_XMLHTTP.aspx?appname=" + escape(document.all("txtAppName").value)+ "&BizObject=" + escape(document.all("txtBizObjectRoot").value) + "&templatetype=" + escape(document.all("txtActType").value) + "&rdnum=" + escape(rdNum);
			ReturnValue = openXMLHTTP(sFile,"getTemplateTitle");
			if (ReturnValue!=undefined)
			{
			    var rowcnt;
			    var j;
			    var k;
			    var RowObj=ReturnValue.split(";");
			    var rowcnt=RowObj.length-1;
			    var oOption;
			    var arrValueText;
			    //此循环从1开始删除，保留为空的那个options
			    for (k=1;k< document.all("ddlTemplete").length;)
			    {
			        document.all("ddlTemplete")[1].removeNode(true);
			    }
		
			    for(j=0;j<=rowcnt;j++)
			    {
					arrValueText = RowObj[j].split(",");
					if (arrValueText!=undefined && arrValueText!="")
					{
			            oOption=document.createElement("OPTION");
			            Form1.ddlTemplete.options.add(oOption);
			            oOption.value=arrValueText[0].toLowerCase(); 	
			            oOption.innerText=arrValueText[1];  
			        }
			    }	
			    
			    chgddlTemplete(); 
			}
			//document.all("appIframe").location = document.all("appIframe").location;
			if(tab0.style.display=="")
			{
			    appIframe.appGrid.frameElement.Query();
			}
			
		}
		
		function changeWeek(check)
		{
		    if (check==1)
		    {
		        document.all.ddlSendMonthToBgnWeek.disabled=false;
		        document.all.s4_SendWeek0.disabled=false;
		        document.all.s4_SendWeek1.disabled=false;
		        document.all.s4_SendWeek2.disabled=false;
		        document.all.s4_SendWeek3.disabled=false;
		        document.all.s4_SendWeek4.disabled=false;
		        document.all.s4_SendWeek5.disabled=false;
		        document.all.s4_SendWeek6.disabled=false;
		        document.all.txtSendMonthToDay.className="num ro";
		        document.all.txtSendMonthToDay.value="";
		    }
		    else
		    {
		        document.all.ddlSendMonthToBgnWeek.disabled=true;
		        document.all.ddlSendMonthToBgnWeek.selectedIndex=0;
		        document.all.s4_SendWeek0.disabled=true;
		        document.all.s4_SendWeek1.disabled=true;
		        document.all.s4_SendWeek2.disabled=true;
		        document.all.s4_SendWeek3.disabled=true;
		        document.all.s4_SendWeek4.disabled=true;
		        document.all.s4_SendWeek5.disabled=true;
		        document.all.s4_SendWeek6.disabled=true;
		        document.all.s4_SendWeek0.checked=false;
		        document.all.s4_SendWeek1.checked=false;
		        document.all.s4_SendWeek2.checked=false;
		        document.all.s4_SendWeek3.checked=false;
		        document.all.s4_SendWeek4.checked=false;
		        document.all.s4_SendWeek5.checked=false;
		        document.all.s4_SendWeek6.checked=false;
		        document.all.txtSendMonthToDay.className="";
		        document.all.txtSendMonthToDay.readOnly=false;
		    }
		    
		}
		//条件刷选
		function OpenTjFilter()
		{
			var sTitle, sHeight, sWidth, sFile;
			
			sTitle = "活动人群定义";
			sHeight = "630";
			sWidth = "840";
			sFile = "/PubProject/Activity/CstFilter.aspx";

			var rdNum = Math.random();

			// 后缀参数
			var sParams = "";
	
	        sParams += "From=" +escape("KHGH") ;  
			sParams += "&BizObject=" + parent.document.all.txtBizObjectRoot.value; 
			sParams += "&open=" + escape(document.all.txtAppName.value); 
			sParams += "&rdnum=" + escape(rdNum);
			sParams += "&ActItemID=" + escape(window.parent.document.all.txtActExecGUID.value);
			sParams += "&mode=" +escape("Add") ;      
			sParams += "&txtType=" +escape(window.parent.document.all.txtActType.value) ;          
			sParams += "&entity=" + parent.document.all.txtBizObjectRoot.value + "&primarykey=" + parent.document.all.txtBizObjectPK.value

			ReturnValue = OpenModalWin(sTitle,sFile,sParams,sWidth,sHeight,window);
			
			if ( ReturnValue != undefined) 
			{ 
				//location.href="/PubProject/Activity/Activity_Index_grid.aspx?ReturnValue=" + window.parent.document.all.txtActExecGUID.value + "&open=" + escape(__open.value);
				window.frames[0].location.reload();
				var arrTrn=ReturnValue;
				//把返回的查询条件填充到父级窗口
				window.parent.document.getElementById("txtFilterStru").value=arrTrn[0];
				window.parent.document.getElementById("divFilter").innerText="\n"+arrTrn[1];
			}
		}
		
		//判断结束日期是否大于等于开始日期
		function ToDecideDate()
		{
		    var sBeginDate=document.all.txtBeginDate.value;
		    var sEndDate=document.all.txtEndDate.value;
		    var sAutoSendType = document.all("appForm_AutoSendType2").checked;
		    if (sBeginDate>sEndDate && sAutoSendType==false)
		    {
		        if(sEndDate!="")
		        {
		            alert("结束日期必须大于等于开始日期");
		            document.all.txtEndDate.value="";
		            document.all.txtEndDate.focus();
		        }
		    }
		}
		
		//检查日历日期
		function CheckSendMonthToDay(val)
		{
			var blnResult;
	        var arr;
	        if (val == undefined || val == "") return;

	        val = val.replace(/，/g, ",");

	        if (val.indexOf(",")> -1)
	        {
                arr = val.split(",");
		        blnResult=true;
		        for(var i=0;i<arr.length;i++)
		        {
			        if (!CheckSon(arr[i]))
			        {
				        blnResult=false;
				        break;
			        }
		        }
	        }
	        else
	        {
		        blnResult = CheckSon(val);
	        }

	        if (!blnResult)
	        {
		        alert("日历日期不符合格式！");
		        event.srcElement.focus();
		        return false;
	        }
            return true;		    
		}
		
		//检查日历日期子过程
		function CheckSon(sValue)
        {
	        var arrSon;
	        if (sValue.indexOf("-")> -1)
	        {
		        arrSon = sValue.split("-");
		        return arrSon.length==2 && isInteger(arrSon[0]) && arrSon[0]<=31 && arrSon[0]>=1 && isInteger(arrSon[1]) && arrSon[1]<=31 && arrSon[1]>=1;
	        }
	        else
	        {
		        return isInteger(sValue) && sValue<=31 && sValue>=1;
	        }
        }
        
        //判断是否为整数
        function isInteger(str)
        {
	        var regu = /^[0-9]{1,}$/;
	        return regu.test(str);
        }
        
        //复制粘贴去除格式
        function myPaste()
        {
            if (document.all.txtActType.value=="短信")
            {
                var t = window.clipboardData.getData("Text");
                window.clipboardData.setData('text',t); 
            }
        }

		</script>
</HEAD>
	<body MS_POSITIONING="GridLayout">
		<form class="map" id="Form1" runat="server">
		    <asp:textbox id="txtIsCreate" style="DISPLAY: none" runat="server"></asp:textbox>
			<asp:textbox id="html" style="DISPLAY: none" runat="server"></asp:textbox>
			<asp:textbox id="txtIsOutIn" style="DISPLAY: none" runat="server"></asp:textbox>
			<asp:textbox id="txtMode" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtActExecGUID" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtActType" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtAppName" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtType" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtIsImport" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtBUGUID" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtUserGUID" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtState" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtBizObject" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtBizObjectView" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtBizObjectPK" style="DISPLAY: none" Runat="server"></asp:textbox>
			<input id="txtTmpAutoSendType" style="DISPLAY: none" type="text">
			<asp:textbox id="txtFilterStru" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtFilter" style="DISPLAY: none" Runat="server"></asp:textbox>
			<!--发送计划的各个字段的数据，放在隐藏控件中，在onload事件里根据数据值设置显示控件的数据-->
			<asp:textbox id="txtTbAutoSendType" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbSendMonthType" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbAutoSendTime" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbAutoSendMinute" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbSendWeek" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbRepeatDayOrWeek" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbSendMonth" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbSendMonthToDay" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbSendMonthToBgnWeek" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtTbAdvanceDay" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtMAGUID" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtBizObjectRoot" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtFuncid" style="DISPLAY: none" Runat="server"></asp:textbox>
			
			<asp:textbox id="txtAddCstGUID" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtProjGUID" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtAddTabName" style="DISPLAY: none" Runat="server"></asp:textbox>
			<asp:textbox id="txtDatasouce" style="DISPLAY: none" Runat="server"></asp:textbox>
		
			<table class="layout" cellSpacing="0" cellPadding="0">
				<COLGROUP>
					<col width="140"> <!-- 导航菜单：140px -->
					<col>
				</COLGROUP>
				<tr height="48">
					<td colSpan="2">
						<!-- 菜单 --><mnu:appformmenu id="appFormMenu" runat="server"></mnu:appformmenu></td>
				</tr>
				<tr>
					<td class="leftBar"><cnt:appnavbar id="appNavBar" runat="server"></cnt:appnavbar></td>
					<td id="tdAreas">
						<div class="area" id="areaForm">
							<table height="100%" cellSpacing="0" cellPadding="0" width="100%">
								<tr>
									<td vAlign="top">
										<div class="tab" id="appForm_tab0" style="DISPLAY: inline">
											<table style="TABLE-LAYOUT: fixed" cellSpacing="0" cellPadding="0" width="100%" border="0">
												<colgroup>
													<col width="60">
													<col width="100">
													<col width="60">
													<col width="100">
													<col width="60">
													<col width="100">
													<col width="60">
													<col width="140">
												</colgroup>
												<tr height="30">
													<td class="req">&nbsp;计划名称</td>
													<td colSpan="5"><asp:textbox id="txtActExecName" maxlength="100" tabIndex="10" runat="server" req="1" Cssclass="txt"
															Width="100%"></asp:textbox></td>
													<td class="req" align="right">发送类型</td>
													<td><asp:radiobutton id="rbSMS" runat="server" Enabled="False" GroupName="acttype" Text="短信"></asp:radiobutton><asp:radiobutton id="rbEmail" runat="server" Enabled="False" GroupName="acttype" Text="Email"></asp:radiobutton></td>
												</tr>
												<tr height="30">
													<td class="req">&nbsp;制定人</td>
													<td><asp:textbox class="txt" id="txtExecutor" tabIndex="20" runat="server" MaxLength="2000" Width="100%"
															readOnly></asp:textbox></td>
													<td class="req" align="right">制定日期&nbsp;</td>
													<td align="right">
														<table style="TABLE-LAYOUT: fixed" cellSpacing="0" cellPadding="0" width="100%">
															<COLGROUP>
																<col>
																<col width="40">
															</COLGROUP>
															<tr>
																<td><input class="dtm" id="txtExecDate" type="text" name="txtExecDate" runat="server" mapType="dtm" returnValue="" defalutvalue="">
																</td>
																<td><IMG class="dtm" src="/_imgs/btn_off_cal.gif"></td>
															</tr>
														</table>
													</td>
													<td class="req" align="right">数据源&nbsp;&nbsp;</td>
													<td><asp:dropdownlist id="ddlYwObject" Cssclass="inputStr" Width="100%" runat="server" onchange="changedYwObject()"></asp:dropdownlist></td>
													<td class="req" align="right">优先级&nbsp;&nbsp;</td>
													<td><asp:dropdownlist id="ddlPriority" runat="server" Cssclass="inputStr" Width="152px">
															<asp:ListItem Value="高">高</asp:ListItem>
															<asp:ListItem Value="一般">一般</asp:ListItem>
															<asp:ListItem Value="低">低</asp:ListItem>
														</asp:dropdownlist></td>
												</tr>
												<tr height="10">
													<td></td>
												</tr>
											</table>
										
											<table style="TABLE-LAYOUT: fixed" cellSpacing="0" cellPadding="0" width="100%" border="0">
												<tr>
													<td width="5"></td>
													<td vAlign="top" align="left" width="100%">
														<table cellSpacing="0" cellPadding="0" width="100%" border="0">
														
															<tr>
																<td class="sec bar" colspan="4">发送计划
																</td>
															</tr>
															<tr>
																<td colspan="4" height="150">
																	<table width="100%" align="left">
																		<tr>
																			<td align="left" width="85px"><input class="" id="appForm_AutoSendType2" onclick="ChgMode(this.value)" type="radio" CHECKED value="一次" name="appForm_AutoSendType"> <label>一次</label><br>
																				<input class="" id="appForm_AutoSendType3" onclick="ChgMode(this.value)" type="radio" value="天"
																					name="appForm_AutoSendType"> <label>天</label><br>
																				<input class="" id="appForm_AutoSendType4" onclick="ChgMode(this.value)" type="radio" value="周"
																					name="appForm_AutoSendType"> <label>周</label><br>
																				<input class="" id="appForm_AutoSendType5" onclick="ChgMode(this.value)" type="radio" value="月份"
																					name="appForm_AutoSendType"> <label>月份</label><br>
																				<input class="" id="appForm_AutoSendType6" onclick="ChgMode(this.value)" type="radio" value="生日"
																					name="appForm_AutoSendType"> <label>生日</label>
																			</td>
																			<td class="wizBox1" vAlign="top" align="left">
																				<table id="Section2" style="TABLE-LAYOUT: fixed; DISPLAY: none" cellSpacing="0" cellPadding="3"
																					width="100%">
																					<%--<tr>
																						<td><asp:radiobutton id="SendMonthType2_1" onclick="" runat="server" GroupName="SendMonthType2" Text="在下列日期："
																								value="0"></asp:radiobutton></td>
																					</tr>
																					<tr>
																						<td>&nbsp;&nbsp; <input id="s2_SendWeek0" type="checkbox" value="0" name="s2_SendWeek">周日
																							<input id="s2_SendWeek1" type="checkbox" value="1" name="s2_SendWeek">周一 <input id="s2_SendWeek2" type="checkbox" value="2" name="s2_SendWeek">周二
																							<input id="s2_SendWeek3" type="checkbox" value="3" name="s2_SendWeek">周三 <input id="s2_SendWeek4" type="checkbox" value="4" name="s2_SendWeek">周四
																							<input id="s2_SendWeek5" type="checkbox" value="5" name="s2_SendWeek">周五 <input id="s2_SendWeek6" type="checkbox" value="6" name="s2_SendWeek">周六
																						</td>
																					</tr>--%>
																					<tr>
																						<td><asp:radiobutton id="SendMonthType2_2" onclick="document.all.txtRepeatDayOrWeek2_1.className='num ro';document.all.txtRepeatDayOrWeek2_1.value='0'" runat="server" GroupName="SendMonthType2" Text="每个工作日"
																								value="1"></asp:radiobutton></td>
																					</tr>
																					<tr>
																						<td><asp:radiobutton id="SendMonthType2_3" onclick="document.all.txtRepeatDayOrWeek2_1.className='num';document.all.txtRepeatDayOrWeek2_1.readOnly=false;" runat="server" GroupName="SendMonthType2" Text="重复执行间隔的天数："
																								value="2"></asp:radiobutton><input class="num" id="txtRepeatDayOrWeek2_1" style="WIDTH: 20px; TEXT-ALIGN: right" type="text"
																								name="txtRepeatDayOrWeek2_1" dt="int" acc="0" grp="false" max="100" min="0">
																						</td>
																					</tr>
																				</table>
																				<table id="Section3" style="TABLE-LAYOUT: fixed; DISPLAY: none" cellSpacing="0" cellPadding="3"
																					width="100%">
																					<COLGROUP>
																						<col>
																					</COLGROUP>
																					<tr>
																						<td>重复执行间隔的周数： <input class="num" id="txtRepeatDayOrWeek3_1" style="WIDTH: 20px; TEXT-ALIGN: right" type="text"
																								name="txtRepeatDayOrWeek3_1" dt="int" acc="0" grp="false" max="100" min="0">
																						</td>
																					</tr>
																					<tr>
																						<td>特定日期：</td>
																					</tr>
																					<tr>
																						<td>&nbsp;&nbsp; <input id="s3_SendWeek0" type="checkbox" value="0" name="s3_SendWeek">周日
																							<input id="s3_SendWeek1" type="checkbox" value="1" name="s3_SendWeek">周一 <input id="s3_SendWeek2" type="checkbox" value="2" name="s3_SendWeek">周二
																							<input id="s3_SendWeek3" type="checkbox" value="3" name="s3_SendWeek">周三 <input id="s3_SendWeek4" type="checkbox" value="4" name="s3_SendWeek">周四
																							<input id="s3_SendWeek5" type="checkbox" value="5" name="s3_SendWeek">周五 <input id="s3_SendWeek6" type="checkbox" value="6" name="s3_SendWeek">周六
																						</td>
																					</tr>
																				</table>
																				<table id="Section4" style="TABLE-LAYOUT: fixed; DISPLAY: none" cellSpacing="0" cellPadding="3"
																					width="100%">
																					<COLGROUP>
																						<col width="100">
																						<col>
																						<col style="PADDING-LEFT: 20px" width="120">
																						<col>
																						<col style="PADDING-LEFT: 20px" width="120">
																						<col>
																					</COLGROUP>
																					<tr>
																						<td colSpan="6">月份：
																							<input id="m01" type="checkbox" value="01" name="s4_SendMonth">一月
																							<input id="m02" type="checkbox" value="02" name="s4_SendMonth">二月 
																							<input id="m03" type="checkbox" value="03" name="s4_SendMonth">三月
																							<input id="m04" type="checkbox" value="04" name="s4_SendMonth">四月 
																							<input id="m05" type="checkbox" value="05" name="s4_SendMonth">五月
																							<input id="m06" type="checkbox" value="06" name="s4_SendMonth">六月
																							<input id="m07" type="checkbox" value="07" name="s4_SendMonth">七月
																							<input id="m08" type="checkbox" value="08" name="s4_SendMonth">八月 
																							<input id="m09" type="checkbox" value="09" name="s4_SendMonth">九月
																							<input id="m10" type="checkbox" value="10" name="s4_SendMonth">十月 
																							<input id="m11" type="checkbox" value="11" name="s4_SendMonth">十一月
																							<input id="m12" type="checkbox" value="12" name="s4_SendMonth">十二月
																						</td>
																					</tr>
																					<tr>
																						<td colSpan="6"><asp:radiobutton id="SendMonthType4_1" onclick="changeWeek(1)" runat="server" GroupName="SendMonthType4" Text="在每月的第几周："
																								value="0"></asp:radiobutton><select id="ddlSendMonthToBgnWeek">
																								<option value="1" selected>第一个</option>
																								<option value="2">第二个</option>
																								<option value="3">第三个</option>
																								<option value="4">第四个</option>
																								<option value="5">第五个</option>
																								<option value="0">最后一个</option>
																							</select>
																					        星期几： 
																							<input id="s4_SendWeek0" type="checkbox" value="0" name="s4_SendWeek">周日
																							<input id="s4_SendWeek1" type="checkbox" value="1" name="s4_SendWeek">周一 
																							<input id="s4_SendWeek2" type="checkbox" value="2" name="s4_SendWeek">周二
																							<input id="s4_SendWeek3" type="checkbox" value="3" name="s4_SendWeek">周三 
																							<input id="s4_SendWeek4" type="checkbox" value="4" name="s4_SendWeek">周四
																							<input id="s4_SendWeek5" type="checkbox" value="5" name="s4_SendWeek">周五
																							<input id="s4_SendWeek6" type="checkbox" value="6" name="s4_SendWeek">周六
																						</td>
																					</tr>
																					<tr>
																						<td colSpan="6"><asp:radiobutton id="SendMonthType4_2" onclick="changeWeek(2)" runat="server" GroupName="SendMonthType4" Text="日历日期："
																								value="1"></asp:radiobutton><input id="txtSendMonthToDay" style="WIDTH: 80px" type="text" name="txtSendMonthToDay" onblur="return CheckSendMonthToDay(this.value)">（例如：2-4，9，11代表2，3，4，9，11这五天）
																						</td>
																					</tr>
																				</table>
																				<table id="Section5" style="TABLE-LAYOUT: fixed; DISPLAY: none" cellSpacing="0" cellPadding="3"
																					width="100%">
																					<tr>
																						<td>提前天数：
																							<input class="num" id="txtAdvanceDay" style="WIDTH: 60px; TEXT-ALIGN: right" type="text" name="txtAdvanceDay" dt="int" acc="0" grp="false" max="100" min="0" defaultvalue="0" format="0" req="0">
																						</td>
																					</tr>
																				</table>
																				<table id="RunTime" cellSpacing="0" cellPadding="3" width="100%">
																					<tr>
																						<td class="req">开始时间： <input class="num" id="txtAutoSendTime" style="WIDTH: 60px; TEXT-ALIGN: right" type="text"
																								name="txtAutoSendTime" dt="int" acc="0" grp="false" max="23" min="0" defaultvalue="0" format="0"  req="1">
																							时 <input class="num" id="txtAutoSendMinute" style="WIDTH: 60px; TEXT-ALIGN: right" type="text"
																								name="txtAutoSendMinute" dt="int" acc="0" grp="false" max="59" min="0" defaultvalue="0"
																								format="0" req="1"> 分
																						</td>
																					</tr>
																				</table>
																			</td>
																		</tr>
																	</table>
																</td>
															</tr>
															<tr id="trTime" style="TABLE-LAYOUT: fixed" height="20">
															<td><table><tr>
																<td class="req" align="left" width="85px">开始日期&nbsp;</td>
																<td align="left" width="100px">
																	<table style="TABLE-LAYOUT: fixed" cellSpacing="0" cellPadding="0" width="100%">
																		<COLGROUP>
																			<col width="80">
																			<col width="40">
																		</COLGROUP>
																		<tr>
																			<td><input class="dtm" id="txtBeginDate" type="text" onblur="ToDecideDate()" onchange="ToDecideDate()" name="txtBeginDate" runat="server" mapType="dtm" returnValue="" defalutvalue="">
	
																			</td>
																			<td><IMG class="dtm" src="/_imgs/btn_off_cal.gif"></td>
																		</tr>
																	</table>
																</td>
																
																<td colspan="2">
																    <table id="Section6" style="TABLE-LAYOUT: fixed; DISPLAY: none" cellSpacing="0" cellPadding="3"
																					width="100%">
																					<tr>
																					    <td width="100px">&nbsp;&nbsp;结束日期&nbsp;</td>
																<td align="right" width="120px">
																	<table style="TABLE-LAYOUT: fixed" cellSpacing="0" cellPadding="0" width="100%">
																		<COLGROUP>
																			<col width="80">
																			<col width="40">
																		</COLGROUP>
																		<tr>
																			<td><input class="dtm" id="txtEndDate" type="text" onblur="ToDecideDate()" onchange="ToDecideDate()" name="txtEndDate" runat="server" mapType="dtm"
																					time="0" returnValue="">
																			</td>
																			<td><IMG class="dtm" src="/_imgs/btn_off_cal.gif"></td>
																		</tr>
																	</table>
																</td>
																					</tr>
																					</table>
																</td>
																</tr></table></td>
															
																
															</tr>
															<tr>
																<td class="sec bar" colSpan="4">发送内容
																</td>
															</tr>
															<tr height="25">
															<td><table><tr>
																<td align="left"  width="85px">内容模板</td>
																<td colSpan="3"><asp:dropdownlist id="ddlTemplete" runat="server" Cssclass="inputStr" Width="426px" AutoPostBack="false"
																		onchange="chgddlTemplete()"></asp:dropdownlist>
																	<input type="button" id="btnTemplateAdd"  onclick="TemplateAdd()" style="width:40px;cursor:hand;" value="新增" disabled style="filter:grey">
																	<label id="CountSMS">您共输入 <span id="Count">0</span> 个字（不包含个性化数据）</label>
																</td>
																</tr></table></td>
															</tr>
														
															<tr height="25">
															<td><table><tr>
																<td class="req" vAlign="top" align="left" width="85px">内容描述</td>
																<td colSpan="3" width="739px">
																	<!-- design view start -->
																	<table id="viewDesign" height="5%" cellSpacing="0" cellPadding="0"
																		width="100%">
																		<tr id="trcrmHtmlBar" style="DISPLAY: none">
																			<td><mwc:htmlbar id="crmHtmlBar" runat="server" type="TemplateEditor"></mwc:htmlbar></td>
																		</tr>
																		<tr>
																			<td>
																				<DIV class=editPage 
																				onselectstart="window.event.cancelBubble=true;return true;" 
																				oncontrolselect="_oActive = event.srcElement;" 
																				id=TemplateEditor 
																				onkeydown="if (window.event.keyCode == 46 &amp;&amp; _oActive) _oActive = null;" 
																				onblur=GenHtml(); onkeyup=textCounter() 
																				onpaste=myPaste(); 
																				contentEditable=true 
																				style="OVERFLOW: auto; HEIGHT: 120px;word-break:break-all" 
																				onclick="_oActive = null;" tabIndex=40 
																				onmouseout=textCounter() ><%= _presentationHtml %></DIV>
																				<div id="TemplateEditorHtml" style="WIDTH: 100px; COLOR: #efefeb; HEIGHT:0px;display:none;"></div>
																			</td>
																		</tr>
																	</table>
																</td>
																
																</tr></table></td>
															</tr>
															
															<tr height="25">
															<td><table><tr>
																<td class="req" align="left" width="100px">发送对象&nbsp;</td>
																<td colSpan="3">
																	<asp:radiobutton id="RdoSearchType1" runat="server" GroupName="SearchType" Text="查询结果" onclick="ChangeTab(0)"></asp:radiobutton>
																	<asp:radiobutton id="RdoSearchType2" runat="server" GroupName="SearchType" Text="查询条件" onclick="ChangeTab(1)"></asp:radiobutton>
																    <label id="LabSearchType" style="DISPLAY: none">（仅使用查询条件中定义的条件筛选客户）</label>
																</td>
																</tr></table></td>
															</tr>
															
														</table>
                                                        <table cellspacing="0" cellpadding="0" width="100%" border="0" height="405px">
                                                            <colgroup>
                                                                <col width="50" />
                                                                <col />
                                                            </colgroup>
                                                            <tr height="1">
                                                                <td colspan="1" height="25" width="100">
                                                                    <span tabindex="0" class="tab tabOn" id="tab0">查询结果</span><span tabindex="1" class="tab tabOn"
                                                                        id="tab1">查询条件</span>
                                                                </td>
                                                                <td align="right">
                                                                    <input type="button" align="right" id="NewButton" onclick="OpenTjFilter()" style="width: 40px;
                                                                        cursor: hand;" value="新增" disabled style="filter: grey">
                                                                </td>
                                                            </tr>
                                                            <tr>
                                                                <td class="sec bar" colspan="2" id="tdIframe">
                                                                    <iframe id="appIframe" src="" frameborder="0" width="100%" scrolling="no" height="100%">
                                                                    </iframe>
                                                                </td>
                                                            </tr>
                                                            <tr style="display: none" id="tdFilter">
                                                                <td class="wizBox1" colspan="2">
                                                                    <div id="divFilter" style="overflow: auto; height: 80px">
                                                                    </div>
                                                                </td>
                                                            </tr>
                                                        </table>
											
													
		</form>
	</body>
</HTML>
